package com.j.lemon.learn.basic.socket;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("localhost",7777);
            OutputStream outputStream=socket.getOutputStream();
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
            PrintWriter printWriter=new PrintWriter(outputStreamWriter,true);
            printWriter.println("hello server~");
            InputStream is = socket.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            System.out.println("客户端说："+br.readLine());

        } catch (IOException e) {
            e.printStackTrace();
        }finally {

        }
    }
}
